/**
 * Copyright (C) 2010 D. Zoller, M. Richter, M. Blumenstein & W. Biller
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.siafu.rest.commands.parser;

import com.googlecode.siafu.rest.model.Context;

/**
 * @author D. Zoller
 * @version $Id: GetContextResultParser.java,v 1.2 2010-06-06 17:54:43 nosebrain Exp $
 */
public class GetContextResultParser extends DefaultSiafuResultParser<Context> {
	private String contextName;

	/**
	 * @param contextName the contextName to set
	 */
	public void setContextName(String contextName) {
		this.contextName = contextName;
	}

	/**
	 * @return the contextName
	 */
	public String getContextName() {
		return contextName;
	}
	
	@Override
	public Context parse(String string) {
		super.parse(string);
		
		final Context context = new Context();
		context.setName(this.contextName);
		context.setValue(string.split("\\/")[1]);
		
		return context;
	}
}
